#include <QApplication>

#include "../libs/sharedLib/pluginloader.h"
#include "../libs/coreLib/qsoftcore.h"
#include "../libs/sharedlib/qprojectcore.h"

#include "mainwindow.h"
#include "qdebugwidget.h"

#include <QFont>
#include <QTextCodec>

int main(int argc,char *argv[])
{
    QApplication a(argc,argv);

    QTextCodec *gbk = QTextCodec::codecForName("UTF-8");
    QTextCodec::setCodecForTr(gbk);
    QTextCodec::setCodecForLocale(gbk);
    QTextCodec::setCodecForCStrings(gbk);

    QFont f=a.font();
    f.setFamily("Arial");
    a.setFont(f);

    g_debugWidget=new QDebugWidget;

    SHAREDLIB::PluginLoader::getPluginLoader()->loadPropertyPlugin();
    SHAREDLIB::PluginLoader::getPluginLoader()->loadWidgetPlugin();
    SHAREDLIB::PluginLoader::getPluginLoader()->loadTabPagePlugin();
    SHAREDLIB::PluginLoader::getPluginLoader()->loadSharedPlugin();
    SHAREDLIB::QProjectCore::getCore();
    CORELIB::QSoftCore::getCore()->init();


    MainWindow w;
    a.setProperty("global_widget",int(&w));
    g_debugWidget->setStyle(a.style());
    w.show();

    int ret=a.exec();
    CORELIB::QSoftCore::releaseCore();
    SHAREDLIB::QProjectCore::releaseCore();
    SHAREDLIB::PluginLoader::releasePluginLoader();
    return ret;
}
